﻿<!doctype html>
<html>
<head>
    <title>个人信息页</title>
    <meta charset="utf-8" />
    <meta http-equiv="description" content="ajax" />
    <link rel="stylesheet" href="../static/css/adapt.css" />
    <link rel="stylesheet" href="../static/css/font-awesome.css" />
    <link rel="stylesheet" href="../static/css/font-awesome.min.css" />
    <script src="../static/js/adapt.js"></script>
    <script src="../static/js/jquery-3.3.1.min.js"></script>
    <!--//authorJen-->
</head>
<body>
    <div class="frame">
        <div class="noticeFra" style="background-image:none">
            <div class="notice">个人信息</div>
            <form class="form" id="formUser" action="user/create" method="post" onsubmit="return false">
                <div class="InfoFra clearfix">
                    <div class="InfoList clearfix"><span class="InfoNotic" style="color:#333"><span class="icon-github-alt color666"></span>姓名：</span><span class="warn icon-lightbulb"></span><input class="fillBlank" placeholder="" name="userName" tag="uname" id="userName" /></div>
                    <div class="InfoList clearfix"><span class="InfoNotic" style="color:#333"><span class="icon-lock color666"></span>密码：</span><span class="warn icon-lightbulb"></span><input class="fillBlank" placeholder="" name="password" tag="upwd" id="password"/></div>
                    <div class="InfoList clearfix"><span class="InfoNotic" style="color:#333"><span class="icon-user color666"></span>真实姓名：</span><span class="warn icon-lightbulb"></span><input class="fillBlank" placeholder="" name="trueName" tag="trueName" id="trueName" /></div>
                    <div class="InfoList clearfix"><span class="InfoNotic" style="color:#333"><span class="icon-phone-sign color666"></span>手机号：</span><span class="warn icon-lightbulb"></span><input class="fillBlank" placeholder="" name="phone" tag="uphone" id="phone"/></div>
                    <div class="InfoList clearfix"><span class="InfoNotic" style="color:#333"><span class="icon-envelope color666"></span>邮箱：</span><span class="warn icon-lightbulb"></span><input class="fillBlank" placeholder="" name="mail" tag="umail" id="mail" /></div>

                    <div class="InfoList clearfix"><span class="InfoNotic" style="color:#333"><span class="icon-envelope color666"></span>公司代码：</span><input class="fillBlank" placeholder="" disabled="disabled" name="CompanyCode" tag="CompanyCode" id="CompanyCode" /></div>
                </div>
                <input class="submitBtn" type="text" id="submit" value="更改"/>
            </form>
        </div>
    </div>
    <script type="text/javascript">
        $(function () {
            //获取表单信息函数
            $("#submit").click(function () {
                var url = $("#formUser").attr("action");
                var data = "{";
                for(i = 0;i<$("#formUser").find($(".fillBlank")).length;i++){
                    data += '"' + $("#formUser").find($(".fillBlank")).eq(i).attr("name") + '":"' + $("#formUser").find($(".fillBlank")).eq(i).val() + '",';

                }
                data += '}';
                data = data.replace(",}", "}");
                console.log(data);
                //var data = new FormData($("#formUser")[0]);
                $.ajax({
                        type: "post",
                        url: url,
                        contentType:"application/json;charset=utf-8",
                        data: data,
                        dataType: "json",
                        success: function (res) {
                            console.log(res)
                        },
                        error: function (res) {
                            console.log("error");
                            console.log(res)
                        }
                    })
            })
        })
    </script>
</body>
</html>